<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/WEB-INF/webpage/common/taglibs.jspf"%>
<!DOCTYPE html>
<html>
<head>
    <title>单号规则明细</title>
    <meta name="decorator" content="form"/>
    <html:css name="bootstrap-fileinput" />
    <html:css name="simditor" />
    <script type="text/javascript" src="${staticPath}/common/js/enter-restrict.js"></script>
</head>

<body class="white-bg"  formid="billRuleDetailForm">
    <form:form id="billRuleDetailForm" modelAttribute="data" action="${adminPath}/sys/billruledetail/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<form:hidden path="fid"/>
		<table  class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
		   <tbody>
				<tr>
					<td  class="width-15 active text-right">	
		              <label><font style="color: red">*</font>规则类型:</label>
		            </td>
					<td class="width-35">
						<form:select path="ruleType" htmlEscape="false" class="form-control"    datatype="*" 
							dict="ruleType" onchange="initStyle(this.value)"   />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		              <label>固定值:</label>
		            </td>
					<td class="width-35">
						<form:input path="value" htmlEscape="false" class="form-control" 
							onkeyup="clearNozm(this)" onbeforepaste="clearNoNum(this)"     />
						<label class="Validform_checktip"></label>
					</td>
				</tr>
				<tr>
					<td  class="width-15 active text-right">	
		              <label>显示格式 :</label>
		            </td>
					<td class="width-35">
						<form:select path="dateFormat" htmlEscape="false" class="form-control" dict="dateFormat" disabled="true"   />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		              <label>随机数类型:</label>
		            </td>
					<td class="width-35">
						<form:select path="randomType" htmlEscape="false" class="form-control"  dict="randomType" disabled="true"   />
						<label class="Validform_checktip"></label>
					</td>
				</tr>
				<tr>
					<td  class="width-15 active text-right">	
		              <label>长度:</label>
		            </td>
					<td class="width-35">
						<form:input path="length" htmlEscape="false" class="form-control"  defaultValue="8" disabled="true"
							onkeyup="enterJustInt(this)" onbeforepaste="enterJustInt(this)"   />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		              <label><font style="color: red">*</font>排序 :</label>
		            </td>
					<td class="width-35">
						<form:input path="sort" htmlEscape="false" class="form-control"  onkeyup="enterJustInt(this)" datatype="*"
							onbeforepaste="enterJustInt(this)" defaultValue="1" ajaxurl="${adminPath}/sys/billruledetail/validate?fid=${data.fid}"   />
						<label class="Validform_checktip"></label>
					</td>
				</tr>
				<tr>
					<td  class="width-15 active text-right">	
		              <label>步长:</label>
		            </td>
					<td class="width-35">
						<form:input path="step" htmlEscape="false" class="form-control" defaultValue="1" 
						disabled="true"  onkeyup="enterJustInt(this)" onbeforepaste="enterJustInt(this)" />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		              <label>补位方式:</label>
		            </td>
					<td class="width-35">
						<form:select path="coverType" htmlEscape="false" class="form-control"  dict="coverType" disabled="true"     />
						<label class="Validform_checktip"></label>
					</td>
				</tr>
				<tr>
					<td  class="width-15 active text-right">	
		              <label>补位值:</label>
		            </td>
					<td class="width-35">
						<form:input path="coverValue" htmlEscape="false" class="form-control" defaultValue="0" 
						disabled="true" onkeyup="clearNozm(this)" onbeforepaste="clearNoNum(this)" />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		              <label><font style="color: red">*</font>是否分隔:</label>
		            </td>
					<td class="width-35">
						<form:radiobuttons path="isSeparator" htmlEscape="false" class="form-control"  datatype="*"
						dict="sf"  defaultValue="0"    cssClass="i-checks required"/>
						<label class="Validform_checktip"></label>
					</td>
				</tr>
				<tr>
					<td  class="width-15 active text-right">	
		              <label><font style="color: red">*</font>分隔符:</label>
		            </td>
					<td class="width-35">
						<form:input path="separator" htmlEscape="false" class="form-control"  defaultValue="-" datatype="*"   />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		              <label>初始值:</label>
		            </td>
					<td class="width-35">
						<form:input path="initialValue" htmlEscape="false" class="form-control"  defaultValue="1" disabled="true"   />
						<label class="Validform_checktip"></label>
					</td>
				</tr>
				<tr>
					<td  class="width-15 active text-right">	
		              <label>自定义sql:</label>
		            </td>
					<td class="width-35">
						<form:textarea path="customSql" rows="2" htmlEscape="false" class="form-control" disabled="true"     />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		              <label>参数字段:</label>
		            </td>
					<td class="width-35">
						<form:textarea path="paramFeild" rows="2" htmlEscape="false" class="form-control" disabled="true"     />
						<label class="Validform_checktip"></label>
					</td>
				</tr>
				<tr>
					<td  class="width-15 active text-right">	
		              <label>备注信息:</label>
		            </td>
					<td class="width-35" colspan="3">
						<form:textarea path="remarks" rows="4" htmlEscape="false" class="form-control"     />
						<label class="Validform_checktip"></label>
					</td>
				</tr>
		   </tbody>
		</table>   
	</form:form>
<html:js name="bootstrap-fileinput" />
<html:js name="simditor" />
<script type="text/javascript">

$(function(){
	init();
});

/**
 * @discription 初始化.<br>
 * @date 2018/08/09.<br>
 * @author zcg.<br>
 */
function init(){
	var ruleType = '${data.ruleType}';
	initStyle(ruleType);
}

/**
 * @discription 初始化界面样式.<br>
 * @date 2018/08/09.<br>
 * @author zcg.<br>
 */
function initStyle(value){
	if(value==1){
		//初始化规定值界面样式
		initRuleStyle();
	}else if(value==2){
		//初始化系统时间界面样式
		initDateFormatStyle();
	}else if(value==3){
		//初始化顺序号界面样式
		initSortStyle();
	}else if(value==4){
		//初始化随机数界面样式
		initRandomStyle();
	}else if(value==5){
		//初始化自定义sql界面样式
		initSqlStyle();
	}
}

/**
 * @discription 初始化固定值界面样式.<br>
 * @date 2018/08/09.<br>
 * @author zcg.<br>
 */
function initRuleStyle(){
	 $("#value").removeAttr("disabled");
	 $("#length").attr("disabled","true");
	 $("#initialValue").attr("disabled","true");
	 $("#coverValue").attr("disabled","true");
	 $("#coverType").attr("disabled","true");
	 $("#length").attr("disabled","true");
	 $("#dateFormat").attr("disabled","true");
	 $("#randomType").attr("disabled","true");
	 $("#step").attr("disabled","true");
	 $("#customSql").attr("disabled","true");
	 $("#paramFeild").attr("disabled","true");
	 
}
 
/**
 * @discription 初始化系统时间界面样式.<br>
 * @date 2018/08/09.<br>
 * @author zcg.<br>
 */
function initDateFormatStyle(){
	 $("#value").attr("disabled","true");
	 $("#length").attr("disabled","true");
	 $("#initialValue").attr("disabled","true");
	 $("#coverValue").attr("disabled","true");
	 $("#coverType").attr("disabled","true");
	 $("#dateFormat").removeAttr("disabled");
	 $("#randomType").attr("disabled","true");
	 $("#step").attr("disabled","true");
	 $("#customSql").attr("disabled","true");
	 $("#paramFeild").attr("disabled","true");
}
 
/**
 * @discription 初始化排序号界面样式.<br>
 * @date 2018/08/09.<br>
 * @author zcg.<br>
 */
function initSortStyle(){
	 $("#value").attr("disabled","true");
	 $("#length").removeAttr("disabled");
	 $("#initialValue").removeAttr("disabled");
	 $("#coverValue").removeAttr("disabled");
	 $("#coverType").removeAttr("disabled");
	 $("#dateFormat").attr("disabled","true");
	 $("#randomType").attr("disabled","true");
	 $("#step").removeAttr("disabled");
	 $("#customSql").attr("disabled","true");
	 $("#paramFeild").attr("disabled","true");
} 
 
/**
 * @discription 初始化随机数界面样式.<br>
 * @date 2018/08/09.<br>
 * @author zcg.<br>
 */
function initRandomStyle(){
	 $("#value").attr("disabled","true");
	 $("#length").removeAttr("disabled");
	 $("#initialValue").attr("disabled","true");
	 $("#coverValue").attr("disabled","true");
	 $("#coverType").attr("disabled","true");
	 $("#dateFormat").attr("disabled","true");
	 $("#randomType").removeAttr("disabled");
	 $("#step").attr("disabled","true");
	 $("#customSql").attr("disabled","true");
	 $("#paramFeild").attr("disabled","true");
}  
 
/**
 * @discription 初始化自定义sql界面样式.<br>
 * @date 2018/08/09.<br>
 * @author zcg.<br>
 */
function initSqlStyle(){
	 $("#value").attr("disabled","true");
	 $("#length").removeAttr("disabled");
	 $("#initialValue").attr("disabled","true");
	 $("#coverValue").attr("disabled","true");
	 $("#coverType").attr("disabled","true");
	 $("#dateFormat").attr("disabled","true");
	 $("#randomType").attr("disabled","true");
	 $("#step").attr("disabled","true");
	 $("#customSql").removeAttr("disabled");
	 $("#paramFeild").removeAttr("disabled");
}
</script>
</body>
</html>